<template>
  <el-button link type="text" @click="clickHandler" size="small" >
    <slot>编辑</slot> 
  </el-button>
</template>
<script>
export default {
  name: 'TableEditorButton',
  inject: ['index','editorIndex'],
  methods: {
    clickHandler() {
      // 更改选中行的状态
      this.editorIndex[this.index] = !this.editorIndex[this.index];
      // vue2使用object.defineProperty 的机制缺陷有关 无法正确的获取响应式数据的变化
      this.$set(this.editorIndex, this.index, this.editorIndex[this.index]);
    }
  }
}
</script>